.class Lcom/openfeint/api/resource/Score$1;
.super Lcom/openfeint/internal/request/JSONRequest;
.source "Score.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/openfeint/api/resource/Score;->submitToInternal(Lcom/openfeint/api/resource/Leaderboard;Ljava/lang/String;Lcom/openfeint/api/resource/Score$SubmitToCB;Z)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/openfeint/api/resource/Score;

.field private final synthetic val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

.field private final synthetic val$fromOffline:Z

.field private final synthetic val$leaderboard:Lcom/openfeint/api/resource/Leaderboard;

.field private final synthetic val$path:Ljava/lang/String;

.field private final synthetic val$uploadBlob:Z


# direct methods
.method constructor <init>(Lcom/openfeint/api/resource/Score;Lcom/openfeint/internal/request/OrderedArgList;Ljava/lang/String;ZLcom/openfeint/api/resource/Score$SubmitToCB;ZLcom/openfeint/api/resource/Leaderboard;)V
    .locals 0
    .parameter
    .parameter "$anonymous0"
    .parameter
    .parameter
    .parameter
    .parameter
    .parameter

    .prologue
    .line 1
    iput-object p1, p0, Lcom/openfeint/api/resource/Score$1;->this$0:Lcom/openfeint/api/resource/Score;

    iput-object p3, p0, Lcom/openfeint/api/resource/Score$1;->val$path:Ljava/lang/String;

    iput-boolean p4, p0, Lcom/openfeint/api/resource/Score$1;->val$fromOffline:Z

    iput-object p5, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    iput-boolean p6, p0, Lcom/openfeint/api/resource/Score$1;->val$uploadBlob:Z

    iput-object p7, p0, Lcom/openfeint/api/resource/Score$1;->val$leaderboard:Lcom/openfeint/api/resource/Leaderboard;

    .line 200
    invoke-direct {p0, p2}, Lcom/openfeint/internal/request/JSONRequest;-><init>(Lcom/openfeint/internal/request/OrderedArgList;)V

    return-void
.end method

.method private final perhapsUploadBlob(ZLjava/lang/Object;)V
    .locals 9
    .parameter "uploadBlob"
    .parameter "responseBody"

    .prologue
    const/4 v8, 0x0

    .line 227
    if-eqz p1, :cond_1

    instance-of v4, p2, Ljava/util/List;

    if-eqz v4, :cond_1

    .line 228
    move-object v0, p2

    check-cast v0, Ljava/util/List;

    move-object v3, v0

    .line 229
    .local v3, scores:Ljava/util/List;,"Ljava/util/List<Lcom/openfeint/api/resource/Score;>;"
    invoke-interface {v3, v8}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/openfeint/api/resource/Score;

    .line 231
    .local v2, s:Lcom/openfeint/api/resource/Score;
    new-instance v1, Lcom/openfeint/internal/request/CompressedBlobPostRequest;

    #getter for: Lcom/openfeint/api/resource/Score;->blobUploadParameters:Lcom/openfeint/internal/resource/BlobUploadParameters;
    invoke-static {v2}, Lcom/openfeint/api/resource/Score;->access$0(Lcom/openfeint/api/resource/Score;)Lcom/openfeint/internal/resource/BlobUploadParameters;

    move-result-object v4

    const-string v5, "blob.%s.bin"

    const/4 v6, 0x1

    new-array v6, v6, [Ljava/lang/Object;

    invoke-virtual {v2}, Lcom/openfeint/api/resource/Score;->resourceID()Ljava/lang/String;

    move-result-object v7

    aput-object v7, v6, v8

    invoke-static {v5, v6}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

    iget-object v6, p0, Lcom/openfeint/api/resource/Score$1;->this$0:Lcom/openfeint/api/resource/Score;

    iget-object v6, v6, Lcom/openfeint/api/resource/Score;->blob:[B

    invoke-direct {v1, v4, v5, v6}, Lcom/openfeint/internal/request/CompressedBlobPostRequest;-><init>(Lcom/openfeint/internal/resource/BlobUploadParameters;Ljava/lang/String;[B)V

    .line 232
    .local v1, postRequest:Lcom/openfeint/internal/request/BlobPostRequest;
    iget-object v4, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    if-eqz v4, :cond_0

    .line 233
    new-instance v4, Lcom/openfeint/api/resource/Score$1$1;

    iget-object v5, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    invoke-direct {v4, p0, v5}, Lcom/openfeint/api/resource/Score$1$1;-><init>(Lcom/openfeint/api/resource/Score$1;Lcom/openfeint/api/resource/Score$SubmitToCB;)V

    invoke-virtual {v1, v4}, Lcom/openfeint/internal/request/BlobPostRequest;->setDelegate(Lcom/openfeint/internal/request/IRawRequestDelegate;)V

    .line 243
    :cond_0
    invoke-virtual {v1}, Lcom/openfeint/internal/request/BlobPostRequest;->launch()V

    .line 245
    .end local v1           #postRequest:Lcom/openfeint/internal/request/BlobPostRequest;
    .end local v2           #s:Lcom/openfeint/api/resource/Score;
    .end local v3           #scores:Ljava/util/List;,"Ljava/util/List<Lcom/openfeint/api/resource/Score;>;"
    :cond_1
    return-void
.end method


# virtual methods
.method public method()Ljava/lang/String;
    .locals 1

    .prologue
    .line 201
    const-string v0, "POST"

    return-object v0
.end method

.method public onFailure(Ljava/lang/String;)V
    .locals 1
    .parameter "exceptionMessage"

    .prologue
    .line 248
    invoke-super {p0, p1}, Lcom/openfeint/internal/request/JSONRequest;->onFailure(Ljava/lang/String;)V

    .line 249
    iget-object v0, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    if-eqz v0, :cond_0

    .line 250
    iget-object v0, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    invoke-virtual {v0, p1}, Lcom/openfeint/api/resource/Score$SubmitToCB;->onFailure(Ljava/lang/String;)V

    .line 252
    :cond_0
    return-void
.end method

.method protected onResponse(ILjava/lang/Object;)V
    .locals 5
    .parameter "responseCode"
    .parameter "responseBody"

    .prologue
    const/4 v3, 0x0

    .line 205
    const/16 v1, 0xc9

    if-ne v1, p1, :cond_3

    .line 206
    iget-boolean v1, p0, Lcom/openfeint/api/resource/Score$1;->val$fromOffline:Z

    if-nez v1, :cond_0

    .line 207
    invoke-static {}, Lcom/openfeint/internal/OpenFeintInternal;->getInstance()Lcom/openfeint/internal/OpenFeintInternal;

    move-result-object v1

    invoke-virtual {v1}, Lcom/openfeint/internal/OpenFeintInternal;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    .line 208
    .local v0, r:Landroid/content/res/Resources;
    const v1, 0x7f04002a

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v1

    const-string v2, "@drawable/of_icon_highscore_notification"

    sget-object v3, Lcom/openfeint/api/Notification$Category;->HighScore:Lcom/openfeint/api/Notification$Category;

    sget-object v4, Lcom/openfeint/api/Notification$Type;->Success:Lcom/openfeint/api/Notification$Type;

    invoke-static {v1, v2, v3, v4}, Lcom/openfeint/internal/notifications/SimpleNotification;->show(Ljava/lang/String;Ljava/lang/String;Lcom/openfeint/api/Notification$Category;Lcom/openfeint/api/Notification$Type;)V

    .line 210
    .end local v0           #r:Landroid/content/res/Resources;
    :cond_0
    iget-object v1, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    if-eqz v1, :cond_1

    iget-object v1, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    const/4 v2, 0x1

    invoke-virtual {v1, v2}, Lcom/openfeint/api/resource/Score$SubmitToCB;->onSuccess(Z)V

    .line 211
    :cond_1
    iget-boolean v1, p0, Lcom/openfeint/api/resource/Score$1;->val$uploadBlob:Z

    invoke-direct {p0, v1, p2}, Lcom/openfeint/api/resource/Score$1;->perhapsUploadBlob(ZLjava/lang/Object;)V

    .line 222
    :cond_2
    :goto_0
    return-void

    .line 212
    :cond_3
    const/16 v1, 0xc8

    if-gt v1, p1, :cond_4

    const/16 v1, 0x12c

    if-ge p1, v1, :cond_4

    .line 213
    iget-object v1, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    if-eqz v1, :cond_2

    iget-object v1, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    invoke-virtual {v1, v3}, Lcom/openfeint/api/resource/Score$SubmitToCB;->onSuccess(Z)V

    goto :goto_0

    .line 214
    :cond_4
    if-eqz p1, :cond_5

    const/16 v1, 0x1f4

    if-gt v1, p1, :cond_6

    :cond_5
    iget-boolean v1, p0, Lcom/openfeint/api/resource/Score$1;->val$fromOffline:Z

    if-nez v1, :cond_6

    .line 216
    iget-object v1, p0, Lcom/openfeint/api/resource/Score$1;->this$0:Lcom/openfeint/api/resource/Score;

    iget-object v2, p0, Lcom/openfeint/api/resource/Score$1;->val$leaderboard:Lcom/openfeint/api/resource/Leaderboard;

    invoke-static {v1, v2}, Lcom/openfeint/internal/offline/OfflineSupport;->postOfflineScore(Lcom/openfeint/api/resource/Score;Lcom/openfeint/api/resource/Leaderboard;)V

    .line 217
    iget-object v1, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    if-eqz v1, :cond_2

    iget-object v1, p0, Lcom/openfeint/api/resource/Score$1;->val$cb:Lcom/openfeint/api/resource/Score$SubmitToCB;

    invoke-virtual {v1, v3}, Lcom/openfeint/api/resource/Score$SubmitToCB;->onSuccess(Z)V

    goto :goto_0

    .line 220
    :cond_6
    invoke-virtual {p0, p2}, Lcom/openfeint/api/resource/Score$1;->onFailure(Ljava/lang/Object;)V

    goto :goto_0
.end method

.method public path()Ljava/lang/String;
    .locals 1

    .prologue
    .line 202
    iget-object v0, p0, Lcom/openfeint/api/resource/Score$1;->val$path:Ljava/lang/String;

    return-object v0
.end method
